package com.chx.mapper;

import com.chx.dto.StockLogPageQueryDto;
import com.chx.entity.StockLogs;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

/**
 * @Author cp-月入过万
 * @Date 2025/5/31
 */
@Mapper
public interface StockLogMapper{
    /**
     * 新增库存流水
     * @param stockLogs
     */
    @Insert("insert into stock_logs( product_id, change_type, change_quantity, before_quantity, after_quantity, related_order_type, related_order_id, user_id, operation_time, remark) " +
            "values" +
            "(#{productId},#{changeType},#{changeQuantity},#{beforeQuantity},#{afterQuantity},#{relatedOrderType},#{relatedOrderId},#{userId},#{operationTime},#{remark}) ")
    void addStockLog(StockLogs stockLogs);

    Page<StockLogs> pageQuery(StockLogPageQueryDto stockLogPageQueryDto);
}
